package objetsBd;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author verpoorten
 */
@Entity
@Table(name = "batiment")
public class BatimentBd implements Serializable, Cloneable {

    private static final long serialVersionUID = 1L;
    private static final String SEQ_ID_BATIMENT = "idBatiment_sequence";

    public static BatimentBd parIdBatiment(Long idBatiment) {
        BatimentBd locataire = new BatimentBd();
        locataire.setIdBatiment(idBatiment);
        return locataire;
    }
    @Id
    @Column(name = "idBatiment")
    @SequenceGenerator(name = SEQ_ID_BATIMENT,
            sequenceName = SEQ_ID_BATIMENT, allocationSize = 1)
    @GeneratedValue(generator = SEQ_ID_BATIMENT)
    private Long idBatiment;
    @Column(name = "denomination")
    private String denomination;
    //information
    @Column(name = "adresseRue")
    private String adresseRue;
    @Column(name = "adresseCP")
    private String adresseCP;
    @Column(name = "adresseLocalite")
    private String adresseLocalite;
    //Détails
    @Column(name = "PEB")
    private String PEB;
    @Column(name = "surface")
    private Double surface;
    @Column(name = "description")
    private String description;
    @Column(name = "dateDeModif")
    @Temporal(TemporalType.DATE)
    private Date dateDeModif;
    //Financement     
    @Column(name = "loyer")
    private Double loyer;
    @Column(name = "charge")
    private Double charge;
    @Column(name = "precompteImmobilier")
    private Double precompteImmobilier;
    //
    @Column(name = "creditBanque")
    private String creditBanque;
    @Column(name = "creditMontantTotal")
    private Double creditMontantTotal;
    @Column(name = "creditMontantAchat")
    private Double creditMontantAchat;
    @Column(name = "creditMontantTravaux")
    private Double creditMontantTravaux;
    @Column(name = "creditMontantMensualite")
    private Double creditMontantMensualite;
    @Column(name = "creditDateDebut")
    @Temporal(TemporalType.DATE)
    private Date creditDateDebut;
    @Column(name = "creditDateFin")
    @Temporal(TemporalType.DATE)
    private Date creditDateFin;
    //Assurance
    @Column(name = "assuranceProprio")
    private String assuranceProprio;
    @Column(name = "assuranceLocataire")
    private String assuranceLocataire;

    public BatimentBd() {
        idBatiment=null;
    }

    public static BatimentBd parId(Long id) {
        BatimentBd batiment = new BatimentBd();
        batiment.idBatiment = id;
        return batiment;

    }
    @Override
    public int hashCode() {
        int hash = 5;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final BatimentBd other = (BatimentBd) obj;
        if (!Objects.equals(this.idBatiment, other.idBatiment)) {
            return false;
        }
        return true;
    }

    public BatimentBd(Long id, String denom1, String adresse1) {
        this.idBatiment = id;
        this.denomination = denom1;
        this.adresseRue = adresse1;
    }

    public static BatimentBd parDenominationBatiment(String denomination) {
        BatimentBd batiment = new BatimentBd();
        batiment.setDenomination(denomination);
        return batiment;
    }

    public Long getIdBatiment() {
        return idBatiment;
    }

    public void setIdBatiment(Long idBatiment) {
        this.idBatiment = idBatiment;
    }

    public String getDenomination() {
        return denomination;
    }

    public void setDenomination(String denomination) {
        this.denomination = denomination;
    }

    public String getAdresse() {
        return adresseRue;
    }

    public void setAdresse(String adresse) {
        this.adresseRue = adresse;
    }

    public String getAdresseRue() {
        return adresseRue;
    }

    public void setAdresseRue(String adresseRue) {
        this.adresseRue = adresseRue;
    }

    public String getAdresseCP() {
        return adresseCP;
    }

    public void setAdresseCP(String adresseCP) {
        this.adresseCP = adresseCP;
    }

    public String getAdresseLocalite() {
        return adresseLocalite;
    }

    public void setAdresseLocalite(String adresseLocalite) {
        this.adresseLocalite = adresseLocalite;
    }

    public String getPEB() {
        return PEB;
    }

    public void setPEB(String PEB) {
        this.PEB = PEB;
    }

    public Double getSurface() {
        return surface;
    }

    public void setSurface(Double surface) {
        this.surface = surface;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getDateDeModif() {
        return dateDeModif;
    }

    public void setDateDeModif(Date dateDeModif) {
        this.dateDeModif = dateDeModif;
    }

    public Double getLoyer() {
        return loyer;
    }

    public void setLoyer(Double loyer) {
        this.loyer = loyer;
    }

    public Double getCharge() {
        return charge;
    }

    public void setCharge(Double charge) {
        this.charge = charge;
    }

    public Double getPrecompteImmobilier() {
        return precompteImmobilier;
    }

    public void setPrecompteImmobilier(Double precompteImmobilier) {
        this.precompteImmobilier = precompteImmobilier;
    }

    public String getCreditBanque() {
        return creditBanque;
    }

    public void setCreditBanque(String creditBanque) {
        this.creditBanque = creditBanque;
    }

    public Double getCreditMontantTotal() {
        return creditMontantTotal;
    }

    public void setCreditMontantTotal(Double creditMontantTotal) {
        this.creditMontantTotal = creditMontantTotal;
    }

    public Double getCreditMontantAchat() {
        return creditMontantAchat;
    }

    public void setCreditMontantAchat(Double creditMontantAchat) {
        this.creditMontantAchat = creditMontantAchat;
    }

    public Double getCreditMontantTravaux() {
        return creditMontantTravaux;
    }

    public void setCreditMontantTravaux(Double creditMontantTravaux) {
        this.creditMontantTravaux = creditMontantTravaux;
    }

    public Double getCreditMontantMensualite() {
        return creditMontantMensualite;
    }

    public void setCreditMontantMensualite(Double creditMontantMensualite) {
        this.creditMontantMensualite = creditMontantMensualite;
    }

    public Date getCreditDateDebut() {
        return creditDateDebut;
    }

    public void setCreditDateDebut(Date creditDateDebut) {
        this.creditDateDebut = creditDateDebut;
    }

    public Date getCreditDateFin() {
        return creditDateFin;
    }

    public void setCreditDateFin(Date creditDateFin) {
        this.creditDateFin = creditDateFin;
    }

    public String getAssuranceProprio() {
        return assuranceProprio;
    }

    public void setAssuranceProprio(String assuranceProprio) {
        this.assuranceProprio = assuranceProprio;
    }

    public String getAssuranceLocataire() {
        return assuranceLocataire;
    }

    public void setAssuranceLocataire(String assuranceLocataire) {
        this.assuranceLocataire = assuranceLocataire;
    }

    public BatimentBd createClone() {
        try {
            return (BatimentBd) super.clone();
        } catch (CloneNotSupportedException ex) {
            throw new IllegalStateException(ex);
        }
    }
}
